package com.rc.saas.mini.service.enterprise;

import com.rc.saas.mini.mapper.enterprise.EnterpriseMemberMapper;
import com.rc.saas.mini.model.enterprise.EnterpriseMember;
import com.rc.saas.mini.model.enterprise.EnterpriseMemberExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wangzhengwei
 * @create 2021/4/20
 */
@Service
public class EnterpriseMemberServiceImpl implements EnterpriseMemberService {

    @Autowired
    private EnterpriseMemberMapper enterpriseMemberMapper;

    @Override
    public EnterpriseMemberMapper getMapper() {
        return enterpriseMemberMapper;
    }

    @Override
    public EnterpriseMember selectByMemberId(Long memberId) {
        EnterpriseMemberExample example = new EnterpriseMemberExample();
        example.createCriteria().andMemberIdEqualTo(memberId);
        return enterpriseMemberMapper.selectByExample(example).stream().findFirst().orElseGet(() -> null);
    }

    @Override
    public List<EnterpriseMember> listByCondition(EnterpriseMember enterpriseMember) {
        return enterpriseMemberMapper.listByCondition(enterpriseMember);
    }

}
